import request from '@/utils/request';
import { other, map } from './prefix';

const artManage = {
  // 查询艺术品列表
  getArt(params) {
    return request.get(other + '/works', { params });
  },
  // 查询艺术品详情
  getOneArt(id) {
    return request.get(other + '/works/' + id);
  },
  // 查询推荐艺术品列表
  getRecommentArt(params) {
    return request.get(other + '/work_recommend', { params });
  },
  // 移动推荐艺术品列表
  moveRecomment(id, type) {
    return request.post(other + '/work_recommend/' + id + '?op=' + type, {});
  },
  // 查询代表作艺术品列表
  getFamousArt(params) {
    return request.get(other + '/art_famous', { params });
  },
  // 移动代表作品列表
  moveFamousArt(id, type) {
    return request.post(other + '/art_famous/' + id + '?op=' + type, {});
  },
  // 创建艺术品
  setArt(params) {
    return request.post(other + '/works', params);
  },
  // 更新艺术品
  updArt(id, params) {
    return request.post(other + '/works/' + id, params);
  },
  // 删除艺术品
  delArt(id) {
    return request.delete(other + '/works/' + id);
  },
  // 上传art图片
  setArtImage(id, params) {
    return request.post(other + '/works/' + id + '?op=upload_file&name=thumbnail', params);
  },
  // 上传大图
  uploadMap(params, process) {
    return request.post(map + '/upload_data?token=79fb054e94d0284966a416a852a6924a&id=/upload', params, {
      onUploadProgress: process
    });
  },
  // 创建大图
  imageMap(params) {
    return request.post(map + '/big_image?token=79fb054e94d0284966a416a852a6924a', params);
  },
  // 上传视频
  uploadVideo(id, params, process) {
    return request.post(other + '/works/' + id + '?op=upload_file&name=work_video', params, {
      onUploadProgress: process
    });
  },
};

export default artManage;
